﻿using System.Linq;
using System.Windows.Controls;
using MouseExtender.Logic.Entities;
using MouseExtender.Logic.Managers;

namespace MouseExtender.Controls.UserControls
{
	/// <summary>
	/// Interaction logic for TabEditUC.xaml
	/// </summary>
	public partial class AddEditTabUC : UserControl
	{
		public TabInfo Item
		{
			get;
			private set;
		}

		public bool IsEdit
		{
			get;
			set;
		}

		public AddEditTabUC()
		{
			InitializeComponent();
		}

		public void SetItem(int tabId)
		{
			Item = new TabInfo()
			{
				Id = tabId,
				Name = SettingsManager.CurrentSettings.TabInfoList.FirstOrDefault(i => i.Id == tabId).Name
			};
			DataContext = Item;
		}

		private void tabTitle_Loaded(object sender, System.Windows.RoutedEventArgs e)
		{
			tabTitle.Focus();
		}
	}
}